<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<button id="btn" type="button">点我</button>
<body>
<script>
    onload = () => {
        //抓取DOM中的按钮
        let btn = document.querySelector('#btn');

        btn.onclick = () => {
            //打开一个空白窗口，_blank表示刷新页面打开，返回新页面
            let newWindow = open("about:blank", "_blank");
            //在写页面上编写'<h1>HelloWorld</h1>'内容
            newWindow.document.write("<h1>HelloWorld</h1>")
        }
    }
</script>
</body>
</html>